/******************************************************************************

  File Name     : hi_utils.h
  Version       : Initial Draft
  Author        : tongzhilin
  Created       : 2020/8/6
  Last Modified :
  Description   : hinnie_utils
  Function List :
  History       :
  1.Date        : 2020/8/6
    Author      : tongzhilin
    Modification: Created file

******************************************************************************/
#pragma once
#include "mp_common.h"
#include "hi_nnie.h"
#include "mpi_sys.h"
#include "hi_comm_svp.h"
#include "alg_struct.h"

SVP_BLOB_S  create_blob_any(INT32 w, INT32 h, INT32 c, INT32 _s32BatchSize);
SVP_BLOB_S  create_blob_from_nnienode(const SVP_NNIE_NODE_S& _stNnieNode, INT32 _s32BatchSize);
void        destroy_blob(SVP_BLOB_S& _stSvpBlob);

SVP_IMAGE_S create_svp_image(INT32 h, INT32 w, INT32 s, INT32 c);
void        destroy_svp_image(SVP_IMAGE_S& _stSvpImage);

void            blob2svp(SVP_BLOB_S& _stSvpBlob, SVP_IMAGE_S& _stSvpImage);
SVP_BLOB_S      svp2blob(SVP_IMAGE_S& _stSvpImage);
SVP_BLOB_S      svp2blob_gray(SVP_IMAGE_S& _stSvpImage);

SVP_MEM_INFO_S  mmz_alloc(INT32 _size);
void mmz_free(SVP_MEM_INFO_S& _stMem);
void mmz_flush(const SVP_MEM_INFO_S& _stMem);
void mmz_flush_blob(const SVP_BLOB_S& _stSvpBlob);
void mmz_flush_blob(const SVP_BLOB_S& _stSvpBlob, INT32 _size);
void mmz_flush_svp_image(const SVP_IMAGE_S& _stSvpImage);

INT32 image_resize_from_rects(SVP_BLOB_S& _stSvpBlob, SVP_IMAGE_S& _SvpImage, std::vector<ALG_RECT_S>& _stvRects,
    UINT32 _u32From, UINT32 _u32To);
INT32 image_affine_3pts(SVP_BLOB_S& _stSvpBlob, SVP_IMAGE_S& _stSvpImageBgr, std::vector<ALG_FACE_POINTS_S>& _stvFacePoints, 
    ALG_FACE_POINTS_S& _stvRefPoints, INT32 _s32Begin, INT32 _s32End);
INT32 image_affine_5pts(SVP_BLOB_S& _stSvpBlob, SVP_IMAGE_S& _stSvpImageBgr, std::vector<ALG_FACE_POINTS_S>& _stvFacePoints, 
    ALG_FACE_POINTS_S& _stvRefPoints, int _s32Begin, int _s32End);

